package cn.walls1717.mapper;

import cn.walls1717.domain.Permission;
import cn.walls1717.domain.Role;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author CJ
 * @date 2020/8/10
 */
public interface RoleMapper {

    /**
     * 根据用户 id 查询出所有对应的角色
     * @param userId .
     * @return .
     * @throws Exception .
     */
    List<Role> findRoleByUserId(String userId) throws Exception;

    List<Role> findAll() throws Exception;

    void save(Role role) throws Exception;

    Role findById(String roleId)throws Exception;

    List<Permission> findOtherPermission(String roleId) throws Exception;

    void addPermissionToRole(@Param("roleId") String roleId, @Param("permissionId") String permissionId) throws Exception;
}
